//
//  UIs_Sudoku_Demo1VC.swift
//  APSwift
//
//  Created by jianbo.pei on 2023/10/7.
//

import UIKit
import Then
import APExtensions

class UIs_Sudoku_Demo1VC: UIViewController {
    
    let titles: [String] = [
        "北京",
        "上海",
        "重庆",
        "天津",
        "郑州",
        "西安",
        "合肥",
        "广州",
        "哈尔滨",
        "南京",
        "武汉",
        "长沙",
        "云南",
        "河南",
        "湖南"
    ]

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        view.backgroundColor = .white
        
        Sudoku.layout { config in
            config.itemHeight = 60
            config.itemCount = self.titles.count
            config.horizontalSpacing = 15
        } completion: { (frame, index) in
            _ = UILabel().then { make in
                view.addSubview(make)
                make.frame = frame
                make.textAlignment = .center
                make.text = self.titles[vmSafe: index]
                make.textColor(.ap.hex("ff4d4d"))
                make.backgroundColor = UIColor.ap.hex("ff4d4d", alpha: 0.1)
                if index == 4 {
                    make.layer.masksToBounds = true
                    make.layer.borderWidth = 1
                    make.layer.cornerRadius = 4
                    make.layer.borderColor = UIColor.ap.hex("ff4d4d").cgColor
                }
            }
        }
    }
}
